import {createContext, useContext} from "react";
import {TabItem} from "@/types/tab";
import {MenuItem} from "@/types/menu";

export type TabContext = {
  tabs: TabItem[];
  activeTab: MenuItem['key'] | undefined;
  openTab?: (menu: MenuItem) => void;
  switchTab?: (key: MenuItem['key']) => void;
};
export const TabContext = createContext<TabContext>({
  tabs: [],
  activeTab: undefined,
});

export const useTabs = () => useContext(TabContext);
